package com.wangxiaotao.springcloud.alibaba.controller;

import com.wangxiaotao.springcloud.alibaba.entity.CommonResult;
import com.wangxiaotao.springcloud.alibaba.entity.Storage;
import com.wangxiaotao.springcloud.alibaba.service.StorageService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequiredArgsConstructor
public class StorageController {
    private final StorageService storageService;

    @GetMapping(value = "/storage/decrease")
    public CommonResult decrease(Long productId,Integer count){
        storageService.decrease(productId,count);
        return new CommonResult(200,"扣减库存成功");
    }

}
